package containers
{
    /*
    **********************************************************************************
    OFFICEMAX INCORPORATED
    Copyright (c) 2010 OfficeMax
    ************************************************************************************
    All Rights Reserved.
    NOTICE: OfficeMax permits you to use, modify, and distribute this file in
    accordance with the terms of the license agreement accompanying it.

    ************************************************************************************
    Author                 		Date           		 Description of change
    (Enter the author			(Enter the date        (What kind of change is done
    name who made the     		when the file is        in the file)
    change or created the file)  created/updated)
    ***********************************************************************************
    */

    import spark.components.Button;
    import spark.components.supportClasses.Skin;

    /**
     * Header for the collapsible panel
     */
    [SkinStates("collapsedup")]
    [SkinStates("collapseddown")]
    [SkinStates("collapsedover")]
    [SkinStates("collapseddisable")]
    public class CollapsiblePanelHeaderButton extends Button
    {
        protected var _collapsed:Boolean;

        public function CollapsiblePanelHeaderButton()
        {
            super();
        }

        /**
         * Gives Collapsed\Not Collapsed status of the panel.
         *
         * @return boolean value which tells whether the panel is collapsed or not.
         *
         */
        [Bindable]
        public function get collapsed():Boolean
        {
            return _collapsed;
        }

        /**
         *
         * @private
         *
         */
        public function set collapsed(value:Boolean):void
        {
            _collapsed = value;
            invalidateSkinState();
        }

        /**
         *
         * @private
         *
         */
        override protected function getCurrentSkinState():String
        {
            var buttonState:String = super.getCurrentSkinState();

            return collapsed ? "collapsed" + super.getCurrentSkinState() : super.getCurrentSkinState();
        }
    }
}
